<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  <title>Ubiquity Desktop Quicklaunch</title>
</head>
<body>
<!-- 
Currently there is NOTHING referencing this file. TRUE or False? 
Either way, it has a .xhtml replacement and translations available
for it now. As for the state of this portion of Ubiquity I am
Uncertain of it's status and referencing.

-L
-->
<p><b>Desktop QuickLaunch</b> is a very experimental new Ubiquity feature
that allows Ubiquity to be used outside of the browser, from anywhere on
your computer. Right now this feature is only supported on OS X, but
we plan to make it available on other platforms too.</p>
<p>To enable Desktop QuickLaunch, click the button below. Once you've
enabled it, you can press option+space to invoke Ubiquity anywhere on
your computer.</p>
<div id="button"></div>
</body>
<script src="resource://ubiquity/scripts/jquery.js"></script>
<script>
$(window).ready(
  function() {
    maybeShowButton();
  });

function maybeShowButton() {
  var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"].
                   getService(Components.interfaces.nsIXULRuntime);
  if (xulRuntime.OS == "Darwin") {
    showButton();
  } else {
    $("#button").text("Sorry, you're not using OS X, so you can't" +
                      "use this feature yet.");
  }
}

function showButton() {
  Components.utils.import("resource://ubiquity/modules/desktop.js");

  if (!Desktop.getGlobalHotkey()) {
    var btn = $('<input type="button" value="Enable Desktop QuickLaunch"/>');
    btn.click(install);
    $("#button").append(btn);
  } else {
    $("#button").text("Desktop QuickLaunch is already enabled.");
  }
}

function install() {
  Components.utils.import("resource://ubiquity/modules/desktop_quicklaunch.js");

  Desktop.registerGlobalHotkey({keycode: Desktop.KEYCODE_SPACE,
                                modifiers: Desktop.MODIFIER_OPTION});
  QuickLaunch.installHotkeyListener();
  $("#button").text("Desktop QuickLaunch is now enabled.");
}

$(window).error(
  function() {
    $("#button").text("Ack, an error occurred. Sorry!");
  });
</script>
</html>
